<?php
class banner_ad
{
	protected	$_id;
	protected	$_order = '1';
	protected	$_DBconn;
	protected	$_front_template;
	protected	$_view;
	protected   $_image_on = '0';
	protected   $_group = '5';
        protected	$translator;
        protected 	$_global_conf;
	
	public function __construct($view) 
	{
		$this->_front_template = Zend_Registry::get('front_template'); 
		$this->_view =	$view;
		
		$helper_path = $this->_view->getHelpers();
		$doc_view = $helper_path[Doctype]->view;
		$catInfo = $doc_view->catInfo;
		$this->_id = ($catInfo['id'])? $catInfo['id'] : '13';
		
		//DB Connection
		$this->_DBconn = Zend_Registry::get('msqli_connection');
		$this->_DBconn->getConnection();
                $this->translator  = Zend_Registry::get('translator');
                $frontController = Zend_Controller_Front::getInstance();
		$this->_global_conf 		= Zend_Registry::get('global_conf');
		$frontController = Zend_Controller_Front::getInstance();	
	}
	
	public function truncate($phrase,$start_words, $max_words)
	{
	   $phrase_array = explode(' ',$phrase);
	   if(count($phrase_array) > $max_words && $max_words > 0)
		  $phrase = implode(' ',array_slice($phrase_array, $start_words, $max_words)).'...';  
	   return $phrase;
	}
	
	public function class_body()
	{
		$partial_Obj = new News_Controller_Helper_PartialAd();
		$partial_info = $partial_Obj->getAdd($this->_id,$this->_order,$this->_group);
                $translator = Zend_Registry::get('translator')
	?>

		<div class="block-ad-banner">
  <div class="block-content">       
   <div class="top">
     <a href="cara-memakai-situs-ini"><div class="icon"></div></a>
     <h6><a href="cara-memakai-situs-ini"><?php echo $translator->translator('block_ads_title_housemaids','','', $this->_front_template['theme_folder']); ?></a></h6>        
     </div>
   <div class="middle">
     <a href="keamanan-prioritas-kami"><div class="icon"></div></a>
     <h6><a href="keamanan-prioritas-kami"><?php echo $translator->translator('block_ads_title_babysitters','','', $this->_front_template['theme_folder']); ?></a></h6>
     </div>
    
   <div class="bottom">
     <a href="selamat-datang-penyalur"><div class="icon"></div></a>
     <h6><a href="selamat-datang-penyalur"><?php echo $translator->translator('block_ads_title_temporarymaids','','', $this->_front_template['theme_folder']); ?></a></h6>       
   </div>
  </div>
 </div>
    
	<?php
	}
}

$banner_ad_class = new banner_ad($this);
try
{
	$banner_ad_class->class_body();
}
catch(Exception $e)
{
	echo 'You have to create menu first.';
}
?>
